<template>
    <div class="change-password">
        <div>
            <input
                type="password"
                v-model="form.oldpassword"
                placeholder="原密码"
            />
        </div>
        <div>
            <input
                type="password"
                v-model="form.newpassword"
                placeholder="新密码"
            />
        </div>
        <div>
            <button @click="changePassword">修改密码</button>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            form: {
                oldpassword: '',
                newpassword: '',
            },
        };
    },
    methods: {
        async changePassword() {
            const res = await this.$http.put('/users/password', this.form);
            console.log('res', res);
        },
    },
};
</script>
